class Solution {
    //解法1：
    public String reverseLeftWords(String s, int n) {
        StringBuilder str = new StringBuilder();
        for (int i = n; i < s.length(); i++) {
            str.append(s.charAt(i));
        }
        for (int i = 0; i < n; i++) {
            str.append(s.charAt(i));
        }
        return str.toString();
    }
    //取余运算 简化解法1代码
    public String reverseLeftWords1(String s, int n) {
        StringBuilder res = new StringBuilder();
        for(int i = n; i < n + s.length(); i++)
            res.append(s.charAt(i % s.length()));
        return res.toString();
    }

    //解法2：
    public String reverseLeftWords2(String s, int n) {
        return s.substring(n) + s.substring(0,2);
    }
}